package com.tanhua.sso.vo;

import cn.hutool.core.convert.Convert;
import com.tanhua.sso.pojo.UserInfo;
import com.tanhua.sso.pojo.Video;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ManageVvideosVo implements Serializable {
    private Integer id;
    private String nickname;
    private Integer userId;
    private Long createDate;
    private String videoUrl;
    private String picUrl;
    private Integer likeCount;
    private Integer commentCount;
    private String text; //文字

    public static ManageVvideosVo inti(Video video, UserInfo userInfo){
        ManageVvideosVo manageVvideosVo=new ManageVvideosVo();
        manageVvideosVo.setCommentCount(video.getCommentCount());
        manageVvideosVo.setCreateDate(video.getCreated());
        manageVvideosVo.setId(Convert.toInt(video.getId()));
        manageVvideosVo.setNickname(userInfo.getNickname());
        manageVvideosVo.setLikeCount(video.getLikeCount());
        manageVvideosVo.setPicUrl(video.getPicUrl());
        manageVvideosVo.setVideoUrl(video.getVideoUrl());
        manageVvideosVo.setUserId(Convert.toInt(video.getUserId()));
        manageVvideosVo.setText(video.getText());
        return manageVvideosVo;
    }
}
